package org.ihelpuoo.orm.filter;

import java.lang.reflect.Field;

public abstract class FieldFilter
{
	public boolean match(Field f)
	{
		return match(f.getName());
	}

	public abstract boolean match(String name);

	public static boolean isIgnore(String name, FieldFilter actived, FieldFilter locked)
	{
		if (null == actived && null == locked)
			return false;
		if (null != actived)
			return !actived.match(name);
		return locked.match(name);
	}

	public static boolean isIgnore(Field f, FieldFilter actived, FieldFilter locked)
	{
		return isIgnore(f.getName(),actived,locked);
	}
}
